package src;

/**
 * 
 * @author Patrik Mihalcin
 */
public class Objekt implements Comparable<Objekt> {
	private Integer index;
	private Double value;
	
	public Objekt(Integer index, Double value) {
		this.index = index;
		this.value = value;
	}

	public Integer getIndex() {
		return index;
	}

	public Double getValue() {
		return value;
	}

	@Override
	public String toString() {
		return "Objekt [index=" + index + ", value=" + value + "]";
	}

	@Override
	public int compareTo(Objekt o) {
		if (index == o.index) {
			return 1;
		}
		return 0;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((index == null) ? 0 : index.hashCode());
		result = prime * result + ((value == null) ? 0 : value.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Objekt other = (Objekt) obj;
		if (index == null) {
			if (other.index != null)
				return false;
		} else if (!index.equals(other.index))
			return false;
		if (value == null) {
			if (other.value != null)
				return false;
		} else if (!value.equals(other.value))
			return false;
		return true;
	}	
}
